<?php
namespace app\mxty\model;

use think\Model;
use think\model\concern\SoftDelete;
use app\common\model\UploadFile;
use app\api\model\User;

class Coach extends Model
{
  use SoftDelete;
  protected $deleteTime = 'delete_time';
  protected $table = 'athlon_employee';
  protected $pk = 'employee_id';

    public function image()
    {
        return $this->hasOne(UploadFile::class, 'file_id', 'image_id');
    }

    public function user()
    {
      return $this->hasOne(User::class);
    }

    public function findEmployeeByUserId($user_id)
    {
      return $this->where('user_id', $user_id)->findOrEmpty();
    }

    public function selectIdsByUserId($user_id)
    {
      return $this->where('user_id', $user_id)->select();
    }
}
